from django.db import models
from django_countries import CountryField
from django.contrib.auth.models import User


class Region( models.Model ):
    nombre = models.CharField( max_length = 50 )
    administrador = models.ForeignKey( User, unique = True)

    def __unicode__( self ):
        return self.nombre

    class Meta:
        verbose_name_plural = 'Regiones'


class Universidad( models.Model ):
    nombre = models.CharField( max_length = 100 )
    telefono = models.CharField( max_length = 30, null = True, blank = True )
    url = models.URLField()
    pais = CountryField()
    direccion = models.CharField( max_length = 200, null = True, blank = True )
    siglas = models.CharField( max_length = 50, null = True, blank = True )
    region = models.ForeignKey( 'Region' )
    administrador = models.ForeignKey( User, unique = True)

    class Meta:
        verbose_name_plural = 'Universidades'

class Universidad_temp( models.Model ):
    nombre = models.CharField( max_length = 100 )
    telefono = models.CharField( max_length = 30, null = True, blank = True )
    url = models.URLField()
    pais = CountryField()
    direccion = models.CharField( max_length = 200, null = True, blank = True )
    siglas = models.CharField( max_length = 50, null = True, blank = True )
    region = models.ForeignKey( 'Region' )
    administrador = models.ForeignKey( User, unique = True )

    def __unicode__( self ):
        return self.nombre

    class Meta:
        verbose_name_plural = 'Universidades'

class Pais_region( models.Model ):
    pais = CountryField( unique = True )
    region = models.ForeignKey( 'Region' )

    class Meta:
        verbose_name_plural = 'Pais_region'
